<template>
    <div>
        <List :index="index" :item="user" :key="user.id" @getIdEvent="getId" v-for="(user,index) in userList"></List>
        <Detail :userId="userId" :userList="userList"></Detail>
    </div>
</template>

<script>
    // import List from "List"
    // import Detail from "Detail"
    import List from "@/components/passvalue/List"
    import Detail from "@/components/passvalue/Detail"

    export default {
        name: "PassValue",
        components: {
            List,
            Detail
        },
        data() {
            return {
                userList: [
                    {
                        id: 1,
                        name: "张三",
                        age: 11,
                        remark: "老子是张三"
                    },
                    {
                        id: 2,
                        name: "李四",
                        age: 22,
                        remark: "老子是李四"
                    }
                ],
                userId: ""
            }
        },
        methods: {
            getId(userId) {
                this.userId = userId
                console.log(userId);
                return userId
            }
        }
    }
</script>

<style scoped>

</style>
